package com.geostar.constructionland.attachment.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.web.multipart.MultipartFile;

import javax.validation.constraints.NotEmpty;
import java.util.Date;

/**
 * 百度上传插件后台接受Model
 * @author yell
 */
@Data
@ApiModel(value = "百度上传组件接收model")
@TableName(value = "geo_attachment")
public class GeoAttachment {
    @ApiModelProperty("百度上传组件上传的ID")
    @TableId(value = "id")
    private String id;

    @TableField(value = "md5_code")
    @ApiModelProperty("附件md5")
    @NotEmpty(message = "md5码不能为空")
    private String md5;

    @TableField(value = "name")
    @ApiModelProperty("文件名称")
    private String name;

    @TableField(value = "type")
    @ApiModelProperty("文件类型")
    private String type;

    @TableField(value = "last_modified_date")
    @ApiModelProperty("文件最后修改时间")
    private Date lastModifiedDate;

    @TableField(value = "file_size")
    @ApiModelProperty("文件大小")
    private long fileSize;

    @ApiModelProperty("文件内容")
    @TableField(exist = false)
    /**exist 为 false 表示该属性不为数据库表字段**/
    private byte[] fileContent;

    @TableField("biz_sys_code")
    @ApiModelProperty("业务系统代码")
    private String bizSysCode;

    @ApiModelProperty("附件保存地址")
    @TableField("file_path")
    private String filePath;

    @ApiModelProperty("分片总数")
    @TableField(exist = false)
    private int chunks;

    @TableField(exist = false)
    @ApiModelProperty("当前分片数量")
    private int chunk;

    @TableField(exist = false)
    @ApiModelProperty("分片大小")
    private int chunkSize;

    @TableField(value = "ext")
    @ApiModelProperty("文件后缀")
    private String ext;
}
